﻿
//**************根据匹配金额的相关计算****************


function Applied() {
    try {
        // 申请匹配金额
        var applyamount = document.getElementById("tc_txtApplyAmount").value;
//        alert(applyamount.propertyIsEnumerable());
        applyamount = Math.round(applyamount * 100) / 100 + 0;
        // 可匹配金额
        var transactionamountleft = document.getElementById("tc_txtTransactionAmountLeft").value;
        transactionamountleft = Math.round(transactionamountleft * 100) / 100 + 0;
        // 订单金额
        var salesorderamountVAT = document.getElementById("tc_txtSalesOrderAmountVAT").value;
        salesorderamountVAT = Math.round(salesorderamountVAT * 100) / 100 + 0;
        if (applyamount <= transactionamountleft) {
            if (applyamount <= salesorderamountVAT) {
                if (salesorderamountVAT != "" && salesorderamountVAT != 0) {
                    // Collection % against sales order
                    document.getElementById("tc_txtCASO").value = Math.round((applyamount / salesorderamountVAT) * 100);
                }
                // Unallocated Balance
                document.getElementById("tc_txtUnallocatedBalance").value = Math.round((transactionamountleft - applyamount) * 100) / 100;
            }
            else {
                alert("申请金额不得大于订单金额！");
            }
        }
        else {
//            alert(applyamount + "-----" + transactionamountleft);
            alert("申请金额不得大于可匹配金额！");
        }
    }
    catch (e) {
        alert(e);
    }
}

//*************根据匹配金额的相关计算**************


function NotBigger(strid, object) {
    var amount = document.getElementById(strid).value;
    amount = Math.abs(Math.round(amount * 100) / 100 + 0);
    var temp = Math.abs(Math.round(object * 100) / 100 + 0);
    if (amount > temp) {
        document.getElementById(strid).value = object;
        alert("不能大于已原数");
    }
}